﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SimpleAppServer.Core
{
    /// <summary>
    /// IAppSession
    /// </summary>
    public interface IAppSession
    {
        /// <summary>
        /// 释放事件
        /// </summary>
        event EventHandler Released;

        /// <summary>
        /// SessionId
        /// </summary>
        Guid Id { get; }

        /// <summary>
        /// User Token
        /// </summary>
        object UserToken { get; }

        /// <summary>
        /// 发送命令
        /// </summary>
        /// <param name="command">命令</param>
        /// <returns>是否发送成功</returns>
        bool Send(ICommand command);

        /// <summary>
        /// 释放Session
        /// </summary>
        void Release();
    }
}
